﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CKS2320.Common
{
    public static class EnumExtensions
    {
        public static string GetDescription(this Enum val)
        {
            var field = val.GetType().GetField(val.ToString());
            var customAttribute = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute));
            return customAttribute == null ? val.ToString() : ((DescriptionAttribute)customAttribute).Description;
        }
    }
    public enum PLCRunTypeEnum
    {
        [Description("A")]
        A,
        [Description("B")]
        B
    }
    public enum PLCOPEnum
    {
        /// <summary>
        /// 主柜
        /// </summary>
        [Description("192.168.10.10")]
        OP00,
        /// <summary>
        /// 第一检测台
        /// </summary>
        [Description("192.168.10.100")]
        OP10,
        /// <summary>
        /// 第二检测台
        /// </summary>
        [Description("192.168.10.120")]
        OP20,
        /// <summary>
        /// 第三检测台
        /// </summary>
        [Description("192.168.10.150")]
        OP30
    }

    public enum PLCResultEnum
    {
        [Description("OK")]
        OK,
        [Description("NG")]
        NG
    }
    public enum KeyenceWhileResultEnum
    {
        [Description("timeout")]
        timeout,
        [Description("NG")]
        error
    }
    public enum PLCDataType
    {
        StationCode,
        StartUpload,
        EndUpLoad,
        PartCode,
        PartCodeTrigger,
        PartCodeResult,
        Result,
        Heart1,
        Heart2,
        DetectionDataStart,
        VoltageWithstandResult,
        CameraDetectionResult,
        StartKeyenceOffset,
        EndKeyenceOffset,
        TotalLengthResult,
        CrsmallEndDistanceResult,
        CrlargeEndDistanceResult,
        Crfront1WaveDistanceResult,
        Crfront64WaveDistanceResult,
        FrontThicknessResult1,
        FrontThicknessResult2,
        FrontThicknessResult3,
        FrontThicknessResult4,
        FrontThicknessResult5,
        FrontThicknessResult6,
        FrontThicknessResult7,
        BackThicknessResult1,
        BackThicknessResult2,
        BackThicknessResult3,
        BackThicknessResult4,
        BackThicknessResult5,
        BackThicknessResult6,
        BackThicknessResult7,
        SmallEndDirectionInspectionResult,
        FacadeCurvatureResult,
        KeyenceResult,
        ReadyKeyence,
        Directioncheck,
        VoltageWithstandResultAC,
        BHVerticalityJudge,
        SHVerticalityJudge,
        EndKeyence3d,
        FinishSave,
        SC01Value,
        SC02Value,
        SC03Value,
        SC04Value,
        SendScValueOk
    }
}
